﻿using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;

namespace SusuCMS.Web.Areas.Admin.Models
{
    public class RegisterModel
    {
        [Required(ErrorMessage = "The User name field is required")]
        [Display(Name = "User name")]
        [Remote("UserNameAvailable", "User", ErrorMessage="The User name is not available")]
        public string UserName { get; set; }

        [Required(ErrorMessage = "The Email address field is required")]
        [RegularExpression("^[a-z0-9_\\+-]+(\\.[a-z0-9_\\+-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*\\.([a-z]{2,4})$", ErrorMessage="Not a valid email")]
        [DataType(DataType.EmailAddress)]
        [Display(Name = "Email address")]
        public string Email { get; set; }

        [Required(ErrorMessage = "The Password field is required")]
        [DataType(DataType.Password)]
        [Display(Name = "Password")]
        public string Password { get; set; }

        [Required(ErrorMessage = "The Confirm password field is required")]
        [Display(Name = "Confirm password")]
        [Compare("Password", ErrorMessage = "The password and confirmation password do not match")]
        public string ConfirmPassword { get; set; }
    }
}